package de.tum.icuproject.persistence.couchdb.select;

import java.io.IOException;

import org.apache.http.client.ClientProtocolException;

import android.util.Log;
import de.tum.icuproject.Subscriber;
import de.tum.icuproject.persistence.couchdb.RequestHandler;

/**
 * Handles select requests
 * @author stefanoturchetta
 *
 */
public abstract class SelectRequestHandler extends RequestHandler {

	public SelectRequestHandler(Subscriber subscriber) {
		super(subscriber);	
	}

	@Override
	protected String doInBackground(String... args) {
		try {
			String requestPage = DB_URL + args[0];
			return this.doGet(requestPage);
		} catch (ArrayIndexOutOfBoundsException e) {
			Log.e("SelectRequestHandler", "Wrong #parameters!");
		} catch (ClientProtocolException e) {
			Log.e("SelectRequestHandler", e.getMessage());
		} catch (IOException e) {
			Log.e("SelectRequestHandler", e.getMessage());
		}
		return null;
	}

}
